package com.shensi.api.admin.client.system;

import com.shensi.api.admin.client.fallback.system.SysDeptClientFallBack;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.common.core.domain.AjaxResult;
import com.shensi.common.core.domain.entity.SysDept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author: budian
 * @since: 2023/11/30
 */
@FeignClient(
        value = CloudConstant.ADMIN_SERVER,
        fallbackFactory = SysDeptClientFallBack.class)
@Component
public interface SysDeptClient {

    /**
     * 获取部门列表
     */
    @GetMapping("/system/dept/list")
    public AjaxResult list(@SpringQueryMap SysDept dept);

    @GetMapping("/system/dept/listTree")
    public AjaxResult listTree(@SpringQueryMap SysDept dept) ;

    /**
     * 根据当前人员信息返回不同的部门信息
     */
    @GetMapping("/system/dept/selectDeptFlage")
    public AjaxResult selectDeptFlage();

    /**
     * 查询部门列表（排除节点）
     */
    @GetMapping("/system/dept/list/exclude/{deptId}")
    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId);

    /**
     * 根据部门编号获取详细信息
     */
    @GetMapping(value = "/system/dept/{deptId}")
    public AjaxResult getInfo(@PathVariable("deptId") Long deptId);

    @GetMapping(value = "/system/dept/getGroupInfo")
    public AjaxResult getGroupInfo(@SpringQueryMap SysDept dept);

    /**
     * 获取当前登录人的站点信息
     */
    @GetMapping(value = "/system/dept/getGroupByUser")
    public AjaxResult getGroupByUser();

    /**
     * 获取部门下拉树列表
     */
    @GetMapping("/system/dept/treeselect")
    public AjaxResult treeselect(@SpringQueryMap SysDept dept);

    /**
     * 获取部门下拉树列表
     */
    @GetMapping("/system/dept/userdepttree")
    public AjaxResult userdepttree(@SpringQueryMap SysDept dept);

    /**
     * 查询所有的集团
     */
    @PostMapping("/system/dept/groupList")
    public AjaxResult groupList(@RequestBody SysDept dept);

    /**
     * 查询当前登陆是是否是lng集团下的
     */
    @GetMapping("/system/dept/isLngInfoList")
    public AjaxResult isLngInfoList();

    /**
     * 根据集团查询油站信息
     */
    @GetMapping("/system/dept/searchDeptList")
    public AjaxResult searchDeptList(@SpringQueryMap SysDept dept);

    /****
     * 查询分配代理管理
     */
    @GetMapping("/system/dept/selectSysAgentList")
    public AjaxResult selectSysAgentList(@SpringQueryMap SysDept dept);

    @GetMapping("/system/dept/selectDeptBalance")
    public AjaxResult selectDeptBalance(@SpringQueryMap SysDept dept);

    /**
     * 加载对应角色部门列表树
     */
    @GetMapping(value = "/system/dept/roleDeptTreeselect/{roleId}")
    public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId);

    /**
     * 新增部门
     */
    @PostMapping("/system/dept")
    public AjaxResult add(@RequestBody SysDept dept);

    /**
     * 修改部门
     */
    @PutMapping("/system/dept")
    public AjaxResult edit(@RequestBody SysDept dept);

    /**
     * 删除部门
     */
    @DeleteMapping("/system/dept/{deptId}")
    public AjaxResult remove(@PathVariable("deptId") Long deptId) ;

    /**
     * 设置分账模式
     */

    @GetMapping("/system/dept/mnoSplit/{deptId}")
    public AjaxResult mnoSplit(@PathVariable("deptId") Long deptId);


    @PutMapping("/system/dept/updateDeptInfo")
    public AjaxResult updateDeptInfo(@RequestBody SysDept dept);

}
